using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ShivamEMR.Model.Domain.PatientDomain;
//using ShivamEMR.Web.Areas.Patient.Models;
using ShivamEMR.Model.DataInterfaces.PatientDataInterf;
using ShivamEMR.Model;

namespace ShivamEMR.Web.Areas.Patient.Controllers
{   
    public class DiagnosisStatusController : Controller
    {
		private readonly IDiagnosisStatusRepository diagnosisstatusRepository;

		// If you are using Dependency Injection, you can delete the following constructor
        public DiagnosisStatusController() //: this(new DiagnosisStatusRepository())
        {
            diagnosisstatusRepository = Registry.RepositoryFactory.GetDiagnosisStatusRepository();
        }

        public DiagnosisStatusController(IDiagnosisStatusRepository diagnosisstatusRepository)
        {
			this.diagnosisstatusRepository = diagnosisstatusRepository;
        }

        //
        // GET: /DiagnosisStatus/

        public ViewResult Index()
        {
            return View(diagnosisstatusRepository.All);//Including(diagnosisstatus => diagnosisstatus.Diagnostics));
        }

        //
        // GET: /DiagnosisStatus/Details/5

        public ViewResult Details(int id)
        {
            return View(diagnosisstatusRepository.Find(id));
        }

        //
        // GET: /DiagnosisStatus/Create

        public ActionResult Create()
        {
            return View();
        } 

        //
        // POST: /DiagnosisStatus/Create

        [HttpPost]
        public ActionResult Create(DiagnosisStatus diagnosisstatus)
        {
            if (ModelState.IsValid) {
                diagnosisstatusRepository.Create(diagnosisstatus);
                diagnosisstatusRepository.Save();
                return RedirectToAction("Index");
            } else {
				return View();
			}
        }
        
        //
        // GET: /DiagnosisStatus/Edit/5
 
        public ActionResult Edit(int id)
        {
             return View(diagnosisstatusRepository.Find(id));
        }

        //
        // POST: /DiagnosisStatus/Edit/5

        [HttpPost]
        public ActionResult Edit(DiagnosisStatus diagnosisstatus)
        {
            if (ModelState.IsValid) {
                diagnosisstatusRepository.Update(diagnosisstatus);
                diagnosisstatusRepository.Save();
                return RedirectToAction("Index");
            } else {
				return View();
			}
        }

        //
        // GET: /DiagnosisStatus/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View(diagnosisstatusRepository.Find(id));
        }

        //
        // POST: /DiagnosisStatus/Delete/5

        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirmed(int id)
        {
            var d = diagnosisstatusRepository.Find(id);
            diagnosisstatusRepository.Delete(d);
            diagnosisstatusRepository.Save();

            return RedirectToAction("Index");
        }
    }
}

